﻿CREATE TABLE [dbo].[OrdenesCompras] (
    [IdOrdenCompra]           INT             IDENTITY (1, 1) NOT NULL,
    [IdProveedor]             INT             NOT NULL,
    [IdTipoEstadoOrdenCompra] TINYINT         NOT NULL,
    [FechaEntrega]            DATE            NOT NULL,
    [DescuentoRecargo]        DECIMAL (19, 4) NOT NULL,
    [Domicilio]               VARCHAR (50)    NOT NULL,
    [Telefono]                VARCHAR (50)    NOT NULL,
    [DomicilioEntrega]        VARCHAR (50)    NOT NULL,
    [Observaciones]           VARCHAR (500)   NOT NULL,
    CONSTRAINT [PK_OrdenesCompras] PRIMARY KEY CLUSTERED ([IdOrdenCompra] ASC),
    CONSTRAINT [FK_OrdenesCompras_Proveedores] FOREIGN KEY ([IdProveedor]) REFERENCES [dbo].[Proveedores] ([IdProveedor]),
    CONSTRAINT [FK_OrdenesCompras_TiposEstadosOrdenesCompras] FOREIGN KEY ([IdTipoEstadoOrdenCompra]) REFERENCES [dbo].[TiposEstadosOrdenesCompras] ([IdTipoEstadoOrdenCompra])
);

